package utilities;

import model.*;
import model.effect.*;
import model.entity.*;
import model.entity.brain.*;
import model.entity.stats.*;
import model.handler.*;
import model.interactionhandler.*;
import model.interactionHandlerInitializer.*;
import model.item.*;
import model.map.*;
import model.resource.*;
import model.skill.*;


public class ModelFactory extends ParameterizedFactory {
	// utilities (Daniel's test objects)
	public static final String TESTABILITY = "utilities.TestAbility";
	public static final String TESTENTITY = "utilities.TestEntity";
	public static final String TESTMODEL = "utilities.TestModel";
	public static final String TESTSTAT = "utilities.TestStat";
	public static final String TESTSTATSET = "utilities.TestStatSet";
	public static final String TESTSTATSUBCLASS = "utilities.TestStatSubclass";
	
	// model
	public static final String MODEL_GAMECLOCK = "model.GameClock";
	public static final String MODEL_MODEL = "model.Model";
	
	// model.effect
	public static final String MODEL_EFFECT_CHANGESTATEFFECT = "model.effect.ChangeStatEffect";
	public static final String MODEL_EFFECT_CONSTANTCHANGESTATEFFECT = "model.effect.ConstantChangeStatEffect";
	public static final String MODEL_EFFECT_EFFECT = "model.effect.Effect";
	public static final String MODEL_EFFECT_FLOWEFFECT = "model.effect.FlowEffect";
	public static final String MODEL_EFFECT_INSTANTDEATHEFFECT = "model.effect.InstantDeathEffect";
	public static final String MODEL_EFFECT_LEVELUPEFFECT = "model.effect.LevelUpEffect";
	public static final String MODEL_EFFECT_PERCENTCHANGESTATEFFECT = "model.effect.PercentChangeStatEffect";
	public static final String MODEL_EFFECT_TELEPORTEFFECT = "model.effect.TeleportEffect";
	
	// model.entity
	public static final String MODEL_ENTITY_AVATAR = "model.entity.Avatar";
	public static final String MODEL_ENTITY_BASICENTITY = "model.entity.BasicEntity";
	public static final String MODEL_ENTITY_BRAINLESSNPC = "model.entity.BrainlessNPC";
	public static final String MODEL_ENTITY_ENTITY = "model.entity.Entity";
	public static final String MODEL_ENTITY_MERCHANTNPC = "model.entity.MerchantNPC";
	public static final String MODEL_ENTITY_MOUNTABLE = "model.entity.Mountable";
	public static final String MODEL_ENTITY_MOUNTABLENPC = "model.entity.MountableNPC";
	public static final String MODEL_ENTITY_NPC = "model.entity.NPC";
	public static final String MODEL_ENTITY_OCCUPATION = "model.entity.Occupation";
	public static final String MODEL_ENTITY_TALKABLE = "model.entity.Talkable";
	public static final String MODEL_ENTITY_VEHICLE = "model.entity.Vehicle";
	
	// model.entity.brain
	public static final String MODEL_ENTITY_BRAIN_AGGRESSIVEBRAIN = "model.entity.brain.AggressiveBrain";
	public static final String MODEL_ENTITY_BRAIN_BEHAVESTATE = "model.entity.brain.BehaveState";
	public static final String MODEL_ENTITY_BRAIN_BRAIN = "model.entity.brain.Brain";
	public static final String MODEL_ENTITY_BRAIN_DUMBBRAIN = "model.entity.brain.DumbBrain";
	public static final String MODEL_ENTITY_BRAIN_MISBEHAVESTATE = "model.entity.brain.MisbehaveState";
	public static final String MODEL_ENTITY_BRAIN_PETBRAIN = "model.entity.brain.PetBrain";
	public static final String MODEL_ENTITY_BRAIN_PETSTATE = "model.entity.brain.PetState";
	public static final String MODEL_ENTITY_BRAIN_WANDERINGBRAIN = "model.entity.brain.WanderingBrain";
	
	// model.entity.stats
	public static final String MODEL_ENTITY_STATS_ARMORRATING = "model.entity.stats.ArmorRating";
	public static final String MODEL_ENTITY_STATS_CONSTANTSTATMODIFIER = "model.entity.stats.ConstantStatModifier";
	public static final String MODEL_ENTITY_STATS_DEFENSIVERATING = "model.entity.stats.DefensiveRating";
	public static final String MODEL_ENTITY_STATS_DERIVEDSTAT = "model.entity.stats.DerivedStat";
	public static final String MODEL_ENTITY_STATS_LEVEL = "model.entity.stats.Level";
	public static final String MODEL_ENTITY_STATS_MAXHP = "model.entity.stats.MaxHP";
	public static final String MODEL_ENTITY_STATS_MAXMP = "model.entity.stats.MaxMP";
	public static final String MODEL_ENTITY_STATS_OFFENSIVERATING = "model.entity.stats.OffensiveRating";
	public static final String MODEL_ENTITY_STATS_PERCENTSTATMODIFIER = "model.entity.stats.PercentStatModifier";
	public static final String MODEL_ENTITY_STATS_STAT = "model.entity.stats.Stat";
	public static final String MODEL_ENTITY_STATS_STATMODIFIER = "model.entity.stats.StatModifier";
	public static final String MODEL_ENTITY_STATS_STATSET = "model.entity.stats.StatSet";
	public static final String MODEL_ENTITY_STATS_STATWITHMAX = "model.entity.stats.StatWithMax";
	
	// model.handler
	public static final String MODEL_HANDLER_AREAEFFECTHANDLER = "model.handler.AreaEffectHandler";
	public static final String MODEL_HANDLER_MOVEMENTHANDLER = "model.handler.MovementHandler";
	
	// model.interactionhandler
	public static final String MODEL_INTERACTIONHANDLER_BASICENTITYHASINTERACTIONINITIALIZER = "model.interactionhandler.BasicEntityHasInteractionInitializer";
	public static final String MODEL_INTERACTIONHANDLER_BUYHANDLER = "model.interactionhandler.BuyHandler";
	public static final String MODEL_INTERACTIONHANDLER_INITIATEFIGHTHANDLER = "model.interactionhandler.InitiateFightHandler";
	public static final String MODEL_INTERACTIONHANDLER_INTERACTIONCONTAINER = "model.interactionhandler.InteractionContainer";
	public static final String MODEL_INTERACTIONHANDLER_INTERACTIONHANDLER = "model.interactionhandler.InteractionHandler";
	public static final String MODEL_INTERACTIONHANDLER_ITEMHANDLER = "model.interactionhandler.ItemHandler";
	public static final String MODEL_INTERACTIONHANDLER_MOUNTHANDLER = "model.interactionhandler.MountHandler";
	public static final String MODEL_INTERACTIONHANDLER_PICKPOCKETHANDLER = "model.interactionhandler.PickPocketHandler";
	public static final String MODEL_INTERACTIONHANDLER_SELLHANDLER = "model.interactionhandler.SellHandler";
	public static final String MODEL_INTERACTIONHANDLER_TALKHANDLER = "model.interactionhandler.TalkHandler";
	
	// model.interactionHandlerInitializer
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_BUYHANDLERINITIALIZER = "model.interactionHandlerInitializer.BuyHandlerInitializer";
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_INITIATEFIGHTHANDLERINITIALIZER = "model.interationHandlerInitializer.InitiateFightHandlerInitializer";
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_INTERACTIONHANDLERINITIALIZER = "model.interactionHandlerInitializer";
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_ITEMHANDLERINITIALIZER = "model.interactionHandlerInitializer.ItemHandlerInitializer";
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_MOUNTHANDLERINITIALIZER = "model.interactionHandlerInitializer.MountHandlerInitializer";
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_PICKPOCKETHANDLERINITIALIZER = "model.interactionHandlerInitializer.PickPocketHandlerInitializer";
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_SELLHANDLERINITIALIZER = "model.interactionHandlerInitializer.SellHandlerInitializer";
	public static final String MODEL_INTERACTIONHANDLERINITIALIZER_TALKHANDLERINITIALIZER = "model.interactionHandlerInitializer.TalkHandlerInitializer";
	
	// model.item
	public static final String MODEL_ITEM_CONDITION = "model.item.Condition";
	public static final String MODEL_ITEM_EQUIPMENTSLOT = "model.item.EquipmentSlot";
	public static final String MODEL_ITEM_EQUIPMENTTYPE = "model.item.EquipmentType";
	public static final String MODEL_ITEM_EQUIPPABLEITEM = "model.item.EquippableItem";
	public static final String MODEL_ITEM_EQUIPPEDINVENTORY = "model.item.EquippedInventory";
	public static final String MODEL_ITEM_INTERACTIVEITEM = "model.item.InteractiveItem";
	public static final String MODEL_ITEM_INVENTORY = "model.item.Inventory";
	public static final String MODEL_ITEM_ITEM = "model.item.Item";
	public static final String MODEL_ITEM_ITEMLIBRARY = "model.item.ItemLibrary";
	public static final String MODEL_ITEM_ONESHOTITEM = "model.item.OneShotItem";
	public static final String MODEL_ITEM_PROJECTILEITEM = "model.item.ProjectileItem";
	public static final String MODEL_ITEM_TAKEABLEITEM = "model.item.TakeableItem";
	
	// model.map
	public static final String MODEL_MAP_AREAEFFECT = "model.map.AreaEffect";
	public static final String MODEL_MAP_DECAL = "model.map.Decal";
	public static final String MODEL_MAP_DIRECTION = "model.map.Direction";
	public static final String MODEL_MAP_FOGOFWAR = "model.map.FogOfWar";
	public static final String MODEL_MAP_GAMEMAP = "model.map.GameMap";
	public static final String MODEL_MAP_HEXLOCATIONPROJECTION = "model.map.HexLocationProjection";
	public static final String MODEL_MAP_LOCATION = "model.map.Location";
	public static final String MODEL_MAP_LOCATIONPROJECTION = "model.map.LocationProjection";
	public static final String MODEL_MAP_MOVEMENTTYPE = "model.map.MovementType";
	public static final String MODEL_MAP_NOLIMITHEXLOCATIONPROJECTION = "model.map.NoLimitHexLocationProjection";
	public static final String MODEL_MAP_OBSTACLE = "model.map.Obstacle";
	public static final String MODEL_MAP_TERRAIN = "model.map.Terrain";
	public static final String MODEL_MAP_WORLD = "model.map.World";
	
	// model.resource
	public static final String MODEL_RESOURCE_AVATARMOUNT = "model.resource.AvatarMount";
	public static final String MODEL_RESOURCE_NPCBATTLELOADER = "model.resource.NPCBattleLoader";
	public static final String MODEL_RESOURCE_NPCTOFIGHT = "model.resource.NPCtoFight";
	
	// model.skill
	public static final String MODEL_SKILL_ACTIVATEABLESKILL = "model.skill.ActivateableSkill";
	public static final String MODEL_SKILL_ANGULARPROJECTILE = "model.skill.AngularProjectile";
	public static final String MODEL_SKILL_DETECTTRAP = "model.skill.DetectTrap";
	public static final String MODEL_SKILL_LINEARPROJECTILE = "model.skill.LinearProjectile";
	public static final String MODEL_SKILL_NONACTIVATEABLESKILL = "model.skill.NonactivateableSkill";
	public static final String MODEL_SKILL_OBSERVATION = "model.skill.Observation";
	public static final String MODEL_SKILL_PROJECTILE = "model.skill.Projectile";
	public static final String MODEL_SKILL_PROJECTILESKILL = "model.skill.ProjectileSkill";
	public static final String MODEL_SKILL_RADIALPROJECTILE = "model.skill.RadialProjectile";
	public static final String MODEL_SKILL_SELFPROJECTILE = "model.skill.SelfProjectile";
	public static final String MODEL_SKILL_SKILL = "model.skill.Skill";
	public static final String MODEL_SKILL_SKILLTYPE = "model.skill.SkillType";
	
	
	
	private ModelFactory() {
		
	}
	
	public static ParameterizedFactory getInstance() {
		if (instance != null) {
			return instance;
		}
		instance = new ModelFactory();
		return instance;
	}
	
	public Archiveable createInstanceWithClassName(String name) {
		// utilities
		if (name.equalsIgnoreCase(TESTABILITY)) {
			return new TestAbility();
		} else if (name.equalsIgnoreCase(TESTENTITY)) {
			return new TestEntity();
		} else if (name.equalsIgnoreCase(TESTMODEL)) {
			return new TestModel();
		} else if (name.equalsIgnoreCase(TESTSTAT)) {
			return new TestStat();
		} else if (name.equalsIgnoreCase(TESTSTATSET)) {
			return new TestStatSet();
		} else if (name.equalsIgnoreCase(TESTSTATSUBCLASS)) {
			return new TestStatSubclass();
		}
		
		
		// model.effect
		if (name.equalsIgnoreCase(MODEL_EFFECT_CONSTANTCHANGESTATEFFECT)) {
			return new ConstantChangeStatEffect();
		} else if (name.equalsIgnoreCase(MODEL_EFFECT_FLOWEFFECT)) {
			return new FlowEffect();
		} else if (name.equalsIgnoreCase(MODEL_EFFECT_INSTANTDEATHEFFECT)) {
			return new InstantDeathEffect();
		} else if (name.equalsIgnoreCase(MODEL_EFFECT_LEVELUPEFFECT)) {
			return new LevelUpEffect();
		} else if (name.equalsIgnoreCase(MODEL_EFFECT_PERCENTCHANGESTATEFFECT)) {
			return new PercentChangeStatEffect();
		} else if (name.equalsIgnoreCase(MODEL_EFFECT_TELEPORTEFFECT)) {
			return new TeleportEffect();
		}
		
		// model.entity
		if (name.equalsIgnoreCase(MODEL_ENTITY_AVATAR)) {
			return new Avatar();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_BASICENTITY)) {
			return new BasicEntity();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_BRAINLESSNPC)) {
			return new BrainlessNPC();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_MERCHANTNPC)) {
			return new MerchantNPC();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_MOUNTABLENPC)) {
			return new MountableNPC();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_NPC)) {
			return new NPC();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_OCCUPATION)) {
			return new Occupation();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_VEHICLE)) {
			return new Vehicle();
		}
		
		// model.entity.brain
		if (name.equalsIgnoreCase(MODEL_ENTITY_BRAIN_AGGRESSIVEBRAIN)) {
			return new AggressiveBrain();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_BRAIN_BEHAVESTATE)) {
			return new BehaveState();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_BRAIN_DUMBBRAIN)) {
			return new DumbBrain();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_BRAIN_MISBEHAVESTATE)) {
			return new MisbehaveState();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_BRAIN_WANDERINGBRAIN)) {
			return new WanderingBrain();
		}
		
		// model.entity.stats
		if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_ARMORRATING)) {
			return new ArmorRating();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_CONSTANTSTATMODIFIER)) {
			return new ConstantStatModifier();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_DEFENSIVERATING)) {
			return new DefensiveRating();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_LEVEL)) {
			return new Level();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_MAXHP)) {
			return new MaxHP();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_MAXMP)) {
			return new MaxMP();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_OFFENSIVERATING)) {
			return new OffensiveRating();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_PERCENTSTATMODIFIER)) {
			return new PercentStatModifier();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_STAT)) {
			return new Stat();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_STATSET)) {
			return new StatSet();
		} else if (name.equalsIgnoreCase(MODEL_ENTITY_STATS_STATWITHMAX)) {
			return new StatWithMax();
		}
		
		
		// model.item
		if (name.equalsIgnoreCase(MODEL_ITEM_CONDITION)) {
			return new Condition();
		} else if (name.equalsIgnoreCase(MODEL_ITEM_EQUIPPABLEITEM)) {
			return new EquippableItem();
		} else if (name.equalsIgnoreCase(MODEL_ITEM_EQUIPPEDINVENTORY)) {
			return new EquippedInventory();
		} else if (name.equalsIgnoreCase(MODEL_ITEM_INTERACTIVEITEM)) {
			return new InteractiveItem();
		} else if (name.equalsIgnoreCase(MODEL_ITEM_INVENTORY)) {
			return new Inventory();
		} else if (name.equalsIgnoreCase(MODEL_ITEM_ITEMLIBRARY)) {
			return new ItemLibrary();
		} else if (name.equalsIgnoreCase(MODEL_ITEM_ONESHOTITEM)) {
			return new OneShotItem();
		} else if (name.equalsIgnoreCase(MODEL_ITEM_TAKEABLEITEM)) {
			return new TakeableItem();
		}
		
		// model.map
		if (name.equalsIgnoreCase(MODEL_MAP_AREAEFFECT)) {
			return new AreaEffect();
		} else if (name.equalsIgnoreCase(MODEL_MAP_DECAL)) {
			return new Decal();
		} else if (name.equalsIgnoreCase(MODEL_MAP_GAMEMAP)) {
			return new GameMap();
		} else if (name.equalsIgnoreCase(MODEL_MAP_HEXLOCATIONPROJECTION)) {
			return new HexLocationProjection();
		} else if (name.equalsIgnoreCase(MODEL_MAP_LOCATION)) {
			return new Location();
		} else if (name.equalsIgnoreCase(MODEL_MAP_NOLIMITHEXLOCATIONPROJECTION)) {
			return new NoLimitHexLocationProjection();
		} else if (name.equalsIgnoreCase(MODEL_MAP_OBSTACLE)) {
			return new Obstacle();
		} else if (name.equalsIgnoreCase(MODEL_MAP_TERRAIN)) {
			return new Terrain();
		}
		
		// model.skill
		if (name.equalsIgnoreCase(MODEL_SKILL_ANGULARPROJECTILE)) {
			return new AngularProjectile();
		} else if (name.equalsIgnoreCase(MODEL_SKILL_DETECTTRAP)) {
			return new DetectTrap();
		} else if (name.equalsIgnoreCase(MODEL_SKILL_LINEARPROJECTILE)) {
			return new LinearProjectile();
		} else if (name.equalsIgnoreCase(MODEL_SKILL_OBSERVATION)) {
			return new Observation();
		} else if (name.equalsIgnoreCase(MODEL_SKILL_PROJECTILESKILL)) {
			return new ProjectileSkill();
		} else if (name.equalsIgnoreCase(MODEL_SKILL_RADIALPROJECTILE)) {
			return new RadialProjectile();
		} else if (name.equalsIgnoreCase(MODEL_SKILL_SELFPROJECTILE)) {
			return new SelfProjectile();
		}
		
		return super.createInstanceWithClassName(name);
	}

}
